/*
	This file is part of CLISRServer.
	Foobar is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	CLISRServer is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with CLISRServer.  If not, see <http://www.gnu.org/licenses/>.
*/

//!TestClass for the class SRSettingsTest
/*!Contains a test harness for the SRSettings class

*/

#include <stdio.h>
#include <string.h>
#include "CUnit/Basic.h"
#include "SRSettings.h"


int init_suite2(void)
 {
   return 0;
 }

int clean_suite2(void)
 {
  return 0;
 }

//! Test for the SRSettingsTest::getPort() method
/*! Tests that the method actually returns the correct (hardcoded, for now) port, namely 2345;
*/

void testgetPort(void)
 {
SRSettings *set = new SRSettings();
CU_ASSERT(set->getPort() == 2345);
 }


//! Test for the SRSettingsTest::getPluginsPath() method
/*! Tests that the method returns the correct path to the plugin, by first setting a path to the plugin and later comparing it to the actual string path;
*/

void testgetPluginsPath(void)
 {
SRSettings *set = new SRSettings();
set -> setPluginsPath("/tmp/superemote/");
CU_ASSERT(set->getPluginsPath() == "/tmp/superemote/");	

 } 

void testgetRemoteLayoutsPath(void)
 {
SRSettings *set = new SRSettings();

	
 } 

//! Test for the SRSettingsTest::setPort() method
/*! Tests that the method correctly sets the port, by first setting the port, and later calling the getPort command and checking the return value;
*/

void testsetPort(void)
 {
	SRSettings *set = new SRSettings();
	set->setPort(1111);
	CU_ASSERT(set->getPort() == 1111);
 }

//! Test for the SRSettingsTest::setPluginsPath() method
/*! Tests that the method correctly sets the path to the plugin, by first setting the path and later calling the getPluginsPath command and checking the return value;
*/

void testsetPluginsPath(void)
 {
	SRSettings *set = new SRSettings();
	set->setPluginsPath("/tmp/asd");
	CU_ASSERT(set->getPluginsPath() == "/tmp/asd");
 } 


//! Test for the SRSettingsTest::setRemoteLayoutsPath() method
/*! Tests that the method correctly sets the path to the layouts, by first setting the path and later calling the getRemoteLayoutsPath command and checking the return value;
*/

void testsetRemoteLayoutsPath(void)
 {
	SRSettings *set = new SRSettings();
	set->setRemoteLayoutsPath("/tmp/asd");
	CU_ASSERT(set->getRemoteLayoutsPath() == "/tmp/asd");
 }






int main()
 {
   CU_pSuite pSuite = NULL;

   /* initialize the CUnit test registry */
   if (CUE_SUCCESS != CU_initialize_registry())
      return CU_get_error();

   /* add a suite to the registry */
   pSuite = CU_add_suite("Suite_2", init_suite2, clean_suite2);
   if (NULL == pSuite) {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* add the tests to the suite */
   if ((NULL == CU_add_test(pSuite, "test of getPorts()", testgetPort)) ||
       (NULL == CU_add_test(pSuite, "test of getPluginsPath()", testgetPluginsPath)) ||
	(NULL == CU_add_test(pSuite, "test of RemoteLayoutsPath()", testgetRemoteLayoutsPath)) ||
	(NULL == CU_add_test(pSuite, "test of setPath()", testsetPort)) ||
	(NULL == CU_add_test(pSuite, "test of setPlauginsPath()", testsetPluginsPath)) ||
	(NULL == CU_add_test(pSuite, "test of setRemoteLayoutsPath()", testsetRemoteLayoutsPath)))
   {
      CU_cleanup_registry();
      return CU_get_error();
   }

   /* Run all tests using the CUnit Basic interface */
   CU_basic_set_mode(CU_BRM_VERBOSE);
   CU_basic_run_tests();
   CU_cleanup_registry();
   return CU_get_error();
 }
